/// <reference path="../lib/lib.ts" />

class BrickBlock {

	private _skin : DisplayObject;
	
	constructor(x : number, y : number) {
		
		if(((x - 6) / 12) % 2 == 1)
			if(((y - 6) / 12) % 2 == 1)
				this._skin = new createjs.Bitmap("js/img/BrickBlock_1.jpg");
			else
				this._skin = new createjs.Bitmap("js/img/BrickBlock_2.jpg");
		else 
			if(((y - 6) / 12) % 2 == 1)
				this._skin = new createjs.Bitmap("js/img/BrickBlock_2.jpg");
			else
				this._skin = new createjs.Bitmap("js/img/BrickBlock_1.jpg");
		
		this._skin.x = x;
		this._skin.y = y;
		this._skin.regX = 6;
		this._skin.regY = 6;
		this._skin.snapToPixel = true;
		this._skin.mouseEnabled = false;
		
	    var shape = new b2PolygonShape();
	    shape.SetAsOrientedBox(6, 6, new b2Vec2(x, y));
	    
	    var fixDef = new b2FixtureDef();
	    fixDef.shape = shape;
	    fixDef.friction = 1;
	    fixDef.restitution = 0;
	    
	    Game.getInstance().createStatic(fixDef, this._skin);
	}
	
}